package com.sky.mapper;

import com.sky.entity.SetmealDish;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealDishMapper {

    /**
     * 根据菜品的ids查询套餐ids
     * @param dishIds
     * @return
     */
    List<Long> getSetMealIdsByDishIds(List<Long> dishIds);

    /**
     * 新增套餐插入此套餐关联的菜品信息
     * @param setMealDishes
     */
    void insert(List<SetmealDish> setMealDishes);

    /**
     * 删除套餐相关的菜品数据
     * @param setMealIds
     */
    void deleteBatch(List<Long> setMealIds);

    /**
     * 根据套餐id删除相关菜品数据
     * @param setMealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setMealId}")
    void deleteBySetMealId(Long setMealId);

    /**
     * 根据套餐id查询所有关联的菜品数据
     * @param setMealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setMealId}")
    List<SetmealDish> getSetMealDishesBySetMealId(Long setMealId);


}
